<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>PowerVR SDK</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<table width="100%">
  <tr>
    <td width="33%">
      <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
    </td>
    <td width="33%">
      <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
    </td>
    <td width="34%">
      <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
    </td>
  </tr>
</table>
<hr>
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>MaterialManager.h</h1><a href="MaterialManager_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/******************************************************************************</span>
00002 <span class="comment"></span>
00003 <span class="comment"> @File         MaterialManager.h</span>
00004 <span class="comment"></span>
00005 <span class="comment"> @Title        A simple material manager for use with PVREngine</span>
00006 <span class="comment"></span>
00007 <span class="comment"> @Version      </span>
00008 <span class="comment"></span>
00009 <span class="comment"> @Copyright    Copyright (C)  Imagination Technologies Limited.</span>
00010 <span class="comment"></span>
00011 <span class="comment"> @Platform     Independent - OGL/OGLES/OGLES2 Specific at the moment</span>
00012 <span class="comment"></span>
00013 <span class="comment"> @Description  Manager for materials in the PVREngine</span>
00014 <span class="comment"></span>
00015 <span class="comment">******************************************************************************/</span>
00016 
00017 <span class="preprocessor">#ifndef MATERIALMANAGER_H</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define MATERIALMANAGER_H</span>
00019 <span class="preprocessor"></span>
00020 <span class="comment">/******************************************************************************</span>
00021 <span class="comment">Includes</span>
00022 <span class="comment">******************************************************************************/</span>
00023 
00024 <span class="preprocessor">#include "PVRTools.h"</span>
00025 <span class="preprocessor">#include "<a class="code" href="Manager_8h.html">Manager.h</a>"</span>
00026 
00027 
00028 <span class="keyword">namespace </span>pvrengine
00029 {
00030 
00031     <span class="keyword">class </span>Material;
00032     <span class="keyword">class </span>UniformHandler;
00033     <span class="keyword">class </span>TextureManager;
00034 
00035     <span class="comment">/*!***************************************************************************</span>
00036 <span class="comment">    * @Class MaterialManager</span>
00037 <span class="comment">    * @Brief Manager for materials in the PVREngine</span>
00038 <span class="comment">    * @Description Manager for materials in the PVREngine</span>
00039 <span class="comment">    *****************************************************************************/</span>
00040     <span class="keyword">class </span>MaterialManager : <span class="keyword">public</span> Manager&lt;Material&gt;
<a name="l00041"></a><a class="code" href="classpvrengine_1_1MaterialManager.html">00041</a>     {
00042 
00043     <span class="keyword">public</span>:
00044         <span class="comment">/*!***************************************************************************</span>
00045 <span class="comment">        @Function           MaterialManager</span>
00046 <span class="comment">        @Description        blank constructor.</span>
00047 <span class="comment">        *****************************************************************************/</span>
00048         <a class="code" href="classpvrengine_1_1MaterialManager.html#a0">MaterialManager</a>();
00049 
00050         <span class="comment">/*!***************************************************************************</span>
00051 <span class="comment">        @Function           ~MaterialManager</span>
00052 <span class="comment">        @Description        destructor.</span>
00053 <span class="comment">        *****************************************************************************/</span>
00054         <a class="code" href="classpvrengine_1_1MaterialManager.html#a1">~MaterialManager</a>();
00055 
00056         <span class="comment">/*!***************************************************************************</span>
00057 <span class="comment">        @Function           MaterialManager</span>
00058 <span class="comment">        @Input              i32TotalMaterials</span>
00059 <span class="comment">        @Description        constructor taking initial number of materials.</span>
00060 <span class="comment">        *****************************************************************************/</span>
00061         <a class="code" href="classpvrengine_1_1MaterialManager.html#a0">MaterialManager</a>(<span class="keywordtype">int</span> i32TotalMaterials);
00062 
00063         <span class="comment">/*!***************************************************************************</span>
00064 <span class="comment">        @Function           MaterialManager</span>
00065 <span class="comment">        @Input              pUniformHandler - Uniform handler for this collection of materials</span>
00066 <span class="comment">        @Return             bool whether initialisation was successful</span>
00067 <span class="comment">        @Description        Initialises material manager</span>
00068 <span class="comment">        *****************************************************************************/</span>
00069         <span class="keywordtype">bool</span> <a class="code" href="classpvrengine_1_1MaterialManager.html#a3">init</a>(<a class="code" href="classpvrengine_1_1UniformHandler.html">UniformHandler</a> *pUniformHandler);
00070 
00071         <span class="comment">/*!***************************************************************************</span>
00072 <span class="comment">        @Function           LoadMaterial</span>
00073 <span class="comment">        @Input              strPFXFilename  PFX filename</span>
00074 <span class="comment">        @Input              strTexturePath  The texture path</span>
00075 <span class="comment">        @Input              sPODMaterial    The POD material</span>
00076 <span class="comment">        @Input              sPODTexture     The POD texture</span>
00077 <span class="comment">        @Input              pUniformHandler The uniform handler for this material</span>
00078 <span class="comment">        @Return             A pointer to the added material</span>
00079 <span class="comment">        @Description        Adds a material to the manager from a POD.</span>
00080 <span class="comment">        *****************************************************************************/</span>
00081         <a class="code" href="classpvrengine_1_1Material.html">Material</a>*   <a class="code" href="classpvrengine_1_1MaterialManager.html#a4">LoadMaterial</a>(<span class="keyword">const</span> CPVRTString&amp; strPFXFilename,
00082             <span class="keyword">const</span>   CPVRTString&amp; strTexturePath,
00083             <span class="keyword">const</span>   SPODMaterial&amp; sPODMaterial,
00084             <span class="keyword">const</span>   SPODTexture&amp; sPODTexture,
00085             <a class="code" href="classpvrengine_1_1UniformHandler.html">UniformHandler</a>* pUniformHandler);
00086 
00087         <span class="comment">/*!***************************************************************************</span>
00088 <span class="comment">        @Function           getMaterial</span>
00089 <span class="comment">        @Input              u32Id   index of material</span>
00090 <span class="comment">        @Return             pointer to indexed material</span>
00091 <span class="comment">        @Description        retrieves a pointer to the requested material from in the</span>
00092 <span class="comment">        manager.</span>
00093 <span class="comment">        *****************************************************************************/</span>
00094         <a class="code" href="classpvrengine_1_1Material.html">Material</a>*   <a class="code" href="classpvrengine_1_1MaterialManager.html#a5">getMaterial</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> u32Id);
00095 
00096         <span class="comment">/*!***************************************************************************</span>
00097 <span class="comment">        @Function           getFlatMaterial</span>
00098 <span class="comment">        @Return             pointer to flat material</span>
00099 <span class="comment">        @Description        Sets the built-in flat material</span>
00100 <span class="comment">        *****************************************************************************/</span>
00101         <a class="code" href="classpvrengine_1_1Material.html">Material</a>*   <a class="code" href="classpvrengine_1_1MaterialManager.html#a6">useDefaultFlatMaterial</a>();
00102 
00103         <span class="comment">/*!***************************************************************************</span>
00104 <span class="comment">        @Function           setFlatMaterial</span>
00105 <span class="comment">        @Return             pointer to flat material</span>
00106 <span class="comment">        @Description        sets a different material for the flat material</span>
00107 <span class="comment">        *****************************************************************************/</span>
00108         <a class="code" href="classpvrengine_1_1Material.html">Material</a>*   <a class="code" href="classpvrengine_1_1MaterialManager.html#a7">setCustomFlatMaterial</a>(<a class="code" href="classpvrengine_1_1Material.html">Material</a>* pFlatMaterial);
00109 
00110         <span class="comment">/*!***************************************************************************</span>
00111 <span class="comment">        @Function           getFlatMaterial</span>
00112 <span class="comment">        @Return             pointer to flat material</span>
00113 <span class="comment">        @Description        retrieves a pointer to the flat material from in the</span>
00114 <span class="comment">        manager.</span>
00115 <span class="comment">        *****************************************************************************/</span>
00116         <a class="code" href="classpvrengine_1_1Material.html">Material</a>*   <a class="code" href="classpvrengine_1_1MaterialManager.html#a8">getFlatMaterial</a>();
00117 
00118         <span class="comment">/*!***************************************************************************</span>
00119 <span class="comment">        @Function           getTextureManager</span>
00120 <span class="comment">        @Return             pointer to Texture Manager</span>
00121 <span class="comment">        @Description        retrieves a pointer to the TextureManager for this instance</span>
00122 <span class="comment">        *****************************************************************************/</span>
00123         <a class="code" href="classpvrengine_1_1TextureManager.html">TextureManager</a>* <a class="code" href="classpvrengine_1_1MaterialManager.html#a9">getTextureManager</a>() <span class="keyword">const</span>;
00124 
00125         <span class="comment">/*!***************************************************************************</span>
00126 <span class="comment">        @Function           ReportActiveMaterial</span>
00127 <span class="comment">        @Input              pNewMaterial the active material</span>
00128 <span class="comment">        @Description        Stores a pointer to the active material and deactivates</span>
00129 <span class="comment">        the previous material (if different).</span>
00130 <span class="comment">        *****************************************************************************/</span>
00131         <span class="keywordtype">void</span> <a class="code" href="classpvrengine_1_1MaterialManager.html#a10">ReportActiveMaterial</a>(<a class="code" href="classpvrengine_1_1Material.html">Material</a>* pNewMaterial);
00132 
00133     <span class="keyword">private</span>:
00134 
00135         <a class="code" href="classpvrengine_1_1Material.html">Material</a>        *m_pFlatMaterial;       
00137         <a class="code" href="classpvrengine_1_1Material.html">Material</a>*       m_pActiveMaterial;      
00139         <a class="code" href="classpvrengine_1_1TextureManager.html">TextureManager</a>*     m_pTextureManager;  
00141         <span class="comment">/*!***************************************************************************</span>
00142 <span class="comment">        @Function           sort</span>
00143 <span class="comment">        @Description        shared initialisation function for constructors</span>
00144 <span class="comment">        *****************************************************************************/</span>
00145         <span class="keywordtype">void</span> internalInit();    
00146     };
00147 
00148 }
00149 <span class="preprocessor">#endif // MATERIALMANAGER_H</span>
00150 <span class="preprocessor"></span>
00151 <span class="comment">/******************************************************************************</span>
00152 <span class="comment">End of file (MaterialManager.h)</span>
00153 <span class="comment">******************************************************************************/</span>
00154 
</pre></div><br>
<br>
<P align=left><FONT size=2><STRONG><A 
   href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> � 
   1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
<hr>
<address style="align: left;"><small><FONT color=f0f>
Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
</body>
</html>
